# eric7.RemoteServerInterface.EricServerFileDialog

Module implementing a file dialog showing the file system of the eric-ide server.

### Global Attributes

None

### Classes

AcceptMode | Class defining the dialog accept modes.
EricServerFileDialog | Class implementing a file dialog showing the file system of the eric-ide server.
FileMode | Class defining what the user may select in the file dialog.

### Functions

getExistingDirectory | Module function to get the name of a directory.
getOpenFileName | Module function to get the name of a file for opening it.
getOpenFileNameAndFilter | Module function to get the name of a file for opening it and the selected file name filter.
getOpenFileNames | Module function to get a list of names of files for opening.
getOpenFileNamesAndFilter | Module function to get a list of names of files for opening and the selected file name filter.
getSaveFileName | Module function to get the name of a file for saving.
getSaveFileNameAndFilter | Module function to get the name of a file for saving and the selected file name filter.
getSaveFileNameWithExtension | Module function to get the name of a file for saving ensuring it has a file extension, if a file type filter was selected.

## AcceptMode

Class defining the dialog accept modes.

### Derived from

enum.Enum

### Class Attributes

AcceptOpen
AcceptSave

### Class Methods

None

### Methods

None

### Static Methods

None

Up

## EricServerFileDialog

Class implementing a file dialog showing the file system of the eric-ide server.

### Derived from

QDialog, Ui_EricServerFileDialog

### Class Attributes

IsDirectoryRole

### Class Methods

None

### Methods

EricServerFileDialog | Constructor
__addToHistory | Private method to add a directory to the history list.
__deleteItem | Private slot to delete the given file/directory item.
__filterList | Private method to filter the files and directories list based on the given filters and whether hidden files/directories should be shown.
__getFullPath | Private method to get the full path for a given file or directory name.
__getNames | Private method to get the selected names list.
__isHidden | Private method to check, if the given name is indicating a hidden file or directory.
__nameCompleterActivated | Private slot handling the activation of the completer.
__reload | Private slot to reload the directory listing.
__renameItem | Private slot to rename the given file/directory item.
__showHiddenToggled | Private slot to handle toggling the display of hidden files/directories.
__updateHistoryButtons | Private method to update the enabled state of the back and forward buttons.
__updateOkButton | Private slot to set the 'OK' button state, icon and label.
__updateUpButton | Private slot to update the enabled state of the 'Up' button.
acceptMode | Public method to get the accept mode of the dialog.
fileMode | Public method to get the current file mode of the dialog.
on_backButton_clicked | Private slot to move back in history of visited directories.
on_filterCombo_currentIndexChanged | Private slot handling the selection of a new file filter..
on_forwardButton_clicked | Private slot to move forward in history of visited directories.
on_listing_customContextMenuRequested | Private slot to show a context menu.
on_listing_itemActivated | Private slot to handle the activation of an item in the list.
on_listing_itemSelectionChanged | Private slot to handle the selection of listed items.
on_nameEdit_textChanged | Private slot handling the editing of a file or directory name.
on_newDirButton_clicked | Private slot to create a new directory.
on_okButton_clicked | Private slot handling the press of the OK button.
on_upButton_clicked | Private slot to move up one level in the hierarchy.
selectedFiles | Public method to get the selected files or the current viewport path.
selectedNameFilter | Public method to get the selected name filter.
setAcceptMode | Public method to set the accept mode of the dialog.
setDirectoriesOnly | Public method to set a flag to just show directories.
setDirectory | Public slot to set the current directory and populate the tree list.
setFileMode | Public method to set the file mode of the dialog.
setNameFilter | Public method to set the current name filter.
setNameFilters | Public method to set the list of file/directory name filters.

### Static Methods

None

#### EricServerFileDialog (Constructor)

EricServerFileDialog(parent=None, caption="", directory="", filter="")

Constructor

parent (QWidget (optional))
  reference to the parent widget (defaults to None)
caption (str (optional))
  dialog title (defaults to "")
directory (str (optional))
  initial directory (defaults to "")
filter (str (optional))
  Qt file filter string (defaults to "")

#### EricServerFileDialog.__addToHistory

__addToHistory(entry)

Private method to add a directory to the history list.

entry (str)
  name of the directory to be added

#### EricServerFileDialog.__deleteItem

__deleteItem(item)

Private slot to delete the given file/directory item.

item (QTreeWidgetItem)
  reference to the item to be deleted

#### EricServerFileDialog.__filterList

__filterList(filters)

Private method to filter the files and directories list based on the given filters and whether hidden files/directories should be shown.

filters (list of str)
  list of filter patterns (only applied to files

#### EricServerFileDialog.__getFullPath

__getFullPath(name)

Private method to get the full path for a given file or directory name.

name (str)
  name of the file or directory

Return:
  full path of the file or directory

Return Type:
  str

#### EricServerFileDialog.__getNames

__getNames()

Private method to get the selected names list.

Return:
  list containing the selected names

Return Type:
  list of str

#### EricServerFileDialog.__isHidden

__isHidden(name)

Private method to check, if the given name is indicating a hidden file or directory.

name (str)
  name of the file or directory

Return:
  flag indicating a hidden file or directory

Return Type:
  bool

#### EricServerFileDialog.__nameCompleterActivated

__nameCompleterActivated()

Private slot handling the activation of the completer.

#### EricServerFileDialog.__reload

__reload()

Private slot to reload the directory listing.

#### EricServerFileDialog.__renameItem

__renameItem(item)

Private slot to rename the given file/directory item.

item (QTreeWidgetItem)
  reference to the item to be renamed

#### EricServerFileDialog.__showHiddenToggled

__showHiddenToggled(on)

Private slot to handle toggling the display of hidden files/directories.

on (bool)
  flag indicating to show hidden files and directories

#### EricServerFileDialog.__updateHistoryButtons

__updateHistoryButtons()

Private method to update the enabled state of the back and forward buttons.

#### EricServerFileDialog.__updateOkButton

__updateOkButton()

Private slot to set the 'OK' button state, icon and label.

#### EricServerFileDialog.__updateUpButton

__updateUpButton()

Private slot to update the enabled state of the 'Up' button.

#### EricServerFileDialog.acceptMode

acceptMode()

Public method to get the accept mode of the dialog.

Return:
  accept mode

Return Type:
  AcceptMode

#### EricServerFileDialog.fileMode

fileMode()

Public method to get the current file mode of the dialog.

Return:
  file mode

Return Type:
  FileMode

#### EricServerFileDialog.on_backButton_clicked

on_backButton_clicked()

Private slot to move back in history of visited directories.

#### EricServerFileDialog.on_filterCombo_currentIndexChanged

on_filterCombo_currentIndexChanged(index)

Private slot handling the selection of a new file filter..

index (int)
  index of the selected entry

#### EricServerFileDialog.on_forwardButton_clicked

on_forwardButton_clicked()

Private slot to move forward in history of visited directories.

#### EricServerFileDialog.on_listing_customContextMenuRequested

on_listing_customContextMenuRequested(pos)

Private slot to show a context menu.

pos (QPoint)
  mouse pointer position to show the menu at

#### EricServerFileDialog.on_listing_itemActivated

on_listing_itemActivated(item, column)

Private slot to handle the activation of an item in the list.

item (QTreeWidgetItem)
  reference to the activated item
column (int)
  column number (unused)

#### EricServerFileDialog.on_listing_itemSelectionChanged

on_listing_itemSelectionChanged()

Private slot to handle the selection of listed items.

#### EricServerFileDialog.on_nameEdit_textChanged

on_nameEdit_textChanged(name)

Private slot handling the editing of a file or directory name.

name (str)
  current text of the name edit

#### EricServerFileDialog.on_newDirButton_clicked

on_newDirButton_clicked()

Private slot to create a new directory.

#### EricServerFileDialog.on_okButton_clicked

on_okButton_clicked()

Private slot handling the press of the OK button.

#### EricServerFileDialog.on_upButton_clicked

on_upButton_clicked()

Private slot to move up one level in the hierarchy.

#### EricServerFileDialog.selectedFiles

selectedFiles()

Public method to get the selected files or the current viewport path.

Return:
  selected files or current viewport path

Return Type:
  str

#### EricServerFileDialog.selectedNameFilter

selectedNameFilter()

Public method to get the selected name filter.

Return:
  selected name filter

Return Type:
  str

#### EricServerFileDialog.setAcceptMode

setAcceptMode(mode)

Public method to set the accept mode of the dialog.

mode (AcceptMode)
  accept mode

#### EricServerFileDialog.setDirectoriesOnly

setDirectoriesOnly(dirsOnly)

Public method to set a flag to just show directories.

dirsOnly (bool)
  flag indicating to just show directories

#### EricServerFileDialog.setDirectory

setDirectory(directory)

Public slot to set the current directory and populate the tree list.

directory (str)
  directory to be set as current. An empty directory sets the server's current directory.

#### EricServerFileDialog.setFileMode

setFileMode(mode)

Public method to set the file mode of the dialog.

mode (FileMode)
  file mode

#### EricServerFileDialog.setNameFilter

setNameFilter(filter)

Public method to set the current name filter.

filter (str)
  filter text to make current

#### EricServerFileDialog.setNameFilters

setNameFilters(filters)

Public method to set the list of file/directory name filters.

filters (list of str)
  list of filter expressions ("filter_name (pattern1 ... patternN)")

Up

## FileMode

Class defining what the user may select in the file dialog.

### Derived from

enum.Enum

### Class Attributes

AnyFile
Directory
ExistingFile
ExistingFiles

### Class Methods

None

### Methods

None

### Static Methods

None

Up

## getExistingDirectory

getExistingDirectory(parent=None, caption="", directory="", dirsOnly=True, withRemote=True)

Module function to get the name of a directory.

parent (QWidget (optional))
  parent widget of the dialog (defaults to None)
caption (str (optional))
  window title of the dialog (defaults to "")
directory (str (optional))
  working directory of the dialog (defaults to "")
dirsOnly (bool (optional))
  flag indicating to just show directories (defaults to True)
withRemote (bool (optional))
  flag indicating to create the file names with the remote indicator (defaults to True)

Return:
  name of selected directory

Return Type:
  str

Up

## getOpenFileName

getOpenFileName(parent=None, caption="", directory="", filterStr="", initialFilter="", withRemote=True, )

Module function to get the name of a file for opening it.

parent (QWidget (optional))
  parent widget of the dialog (defaults to None)
caption (str (optional))
  window title of the dialog (defaults to "")
directory (str (optional))
  working directory of the dialog (defaults to "")
filterStr (str (optional))
  filter string for the dialog (defaults to "")
initialFilter (str (optional))
  initial filter for the dialog (defaults to "")
withRemote (bool (optional))
  flag indicating to create the file names with the remote indicator (defaults to True)

Return:
  name of file to be opened

Return Type:
  str

Up

## getOpenFileNameAndFilter

getOpenFileNameAndFilter(parent=None, caption="", directory="", filterStr="", initialFilter="", withRemote=True, )

Module function to get the name of a file for opening it and the selected file name filter.

parent (QWidget (optional))
  parent widget of the dialog (defaults to None)
caption (str (optional))
  window title of the dialog (defaults to "")
directory (str (optional))
  working directory of the dialog (defaults to "")
filterStr (str (optional))
  filter string for the dialog (defaults to "")
initialFilter (str (optional))
  initial filter for the dialog (defaults to "")
withRemote (bool (optional))
  flag indicating to create the file names with the remote indicator (defaults to True)

Return:
  tuple containing the list of file names to be opened and the selected file name filter

Return Type:
  tuple of (list of str, str)

Up

## getOpenFileNames

getOpenFileNames(parent=None, caption="", directory="", filterStr="", initialFilter="", withRemote=True, )

Module function to get a list of names of files for opening.

parent (QWidget (optional))
  parent widget of the dialog (defaults to None)
caption (str (optional))
  window title of the dialog (defaults to "")
directory (str (optional))
  working directory of the dialog (defaults to "")
filterStr (str (optional))
  filter string for the dialog (defaults to "")
initialFilter (str (optional))
  initial filter for the dialog (defaults to "")
withRemote (bool (optional))
  flag indicating to create the file names with the remote indicator (defaults to True)

Return:
  list of file names to be opened

Return Type:
  list of str

Up

## getOpenFileNamesAndFilter

getOpenFileNamesAndFilter(parent=None, caption="", directory="", filterStr="", initialFilter="", withRemote=True, )

Module function to get a list of names of files for opening and the selected file name filter.

parent (QWidget (optional))
  parent widget of the dialog (defaults to None)
caption (str (optional))
  window title of the dialog (defaults to "")
directory (str (optional))
  working directory of the dialog (defaults to "")
filterStr (str (optional))
  filter string for the dialog (defaults to "")
initialFilter (str (optional))
  initial filter for the dialog (defaults to "")
withRemote (bool (optional))
  flag indicating to create the file names with the remote indicator (defaults to True)

Return:
  tuple containing the list of file names to be opened and the selected file name filter

Return Type:
  tuple of (list of str, str)

Up

## getSaveFileName

getSaveFileName(parent=None, caption="", directory="", filterStr="", initialFilter="", withRemote=True, )

Module function to get the name of a file for saving.

parent (QWidget (optional))
  parent widget of the dialog (defaults to None)
caption (str (optional))
  window title of the dialog (defaults to "")
directory (str (optional))
  working directory of the dialog (defaults to "")
filterStr (str (optional))
  filter string for the dialog (defaults to "")
initialFilter (str (optional))
  initial filter for the dialog (defaults to "")
withRemote (bool (optional))
  flag indicating to create the file names with the remote indicator (defaults to True)

Return:
  name of file to be saved

Return Type:
  str

Up

## getSaveFileNameAndFilter

getSaveFileNameAndFilter(parent=None, caption="", directory="", filterStr="", initialFilter="", withRemote=True, )

Module function to get the name of a file for saving and the selected file name filter.

parent (QWidget (optional))
  parent widget of the dialog (defaults to None)
caption (str (optional))
  window title of the dialog (defaults to "")
directory (str (optional))
  working directory of the dialog (defaults to "")
filterStr (str (optional))
  filter string for the dialog (defaults to "")
initialFilter (str (optional))
  initial filter for the dialog (defaults to "")
withRemote (bool (optional))
  flag indicating to create the file names with the remote indicator (defaults to True)

Return:
  name of file to be saved and selected filter

Return Type:
  tuple of (str, str)

Up

## getSaveFileNameWithExtension

getSaveFileNameWithExtension(parent=None, caption="", directory="", filterStr="", initialFilter="", withRemote=True, )

Module function to get the name of a file for saving ensuring it has a file extension, if a file type filter was selected.

parent (QWidget (optional))
  parent widget of the dialog (defaults to None)
caption (str (optional))
  window title of the dialog (defaults to "")
directory (str (optional))
  working directory of the dialog (defaults to "")
filterStr (str (optional))
  filter string for the dialog (defaults to "")
initialFilter (str (optional))
  initial filter for the dialog (defaults to "")
withRemote (bool (optional))
  flag indicating to create the file names with the remote indicator (defaults to True)

Return:
  name of file to be saved

Return Type:
  tuple of (str, str)

Up